<% if session[:user_id] %>	
	<h1>Placas base disponibles</h1>

	<table border=1>
		<tr>
		  <th>Título</th>
		  <th>Descripción</th>
		  <th>Socket</th>
		  <th>Velocidad del procesador (MHz)</th>
		  <th>Tipo de memoria</th>
		  <th>Ranuras de memoria</th>
		  <th>Dimensiones</th>
		  <th>Factor de forma</th>
		  <th>Ranuras PCI</th>
		  <th>Ranuras PCI Express</th>
		  <th>Ranuras PCI16</th>
		  <th>Ranuras AGP</th>
		  <th>URL</th>
		  <th>Precio</th>
		  <th></th>
		  <th></th>
		  <th></th>
		</tr>

	<% @motherboards.each do |motherboard| %>
		<tr>
		  <td><%= motherboard.title %></td>
		  <td><%= motherboard.description %></td>
    <td class="center"><%= motherboard.socket %></td>
    <td class="center"><%= motherboard.procspeed %></td>
    <td class="center"><%= motherboard.memtype %></td>
    <td class="center"><%= motherboard.memslots %></td>
    <td class="center"><%= motherboard.dimensions %></td>
    <td class="center"><%= motherboard.factor %></td>
    <td class="center"><%= motherboard.pcislots %></td>
    <td class="center"><%= motherboard.pcie %></td>
    <td class="center"><%= motherboard.pci16 %></td>
    <td class="center"><%= motherboard.agp %></td>
		  <td><%= link_to motherboard.product_url, motherboard.product_url, :target => '_blank' %></td>
    <td class="center"><%= motherboard.price %></td>
		  <td><%= link_to 'Mostrar', motherboard %></td>
		  <td><%= link_to 'Editar', edit_motherboard_path(motherboard) %></td>
		  <td><%= link_to 'Eliminar', motherboard, method: :delete, data: { confirm: '¿Está seguro?' } %></td>
		</tr>
	<% end %>
	</table>

	<br />

	<%= link_to 'Nueva placa base', new_motherboard_path %>
<% else %>
	<% if notice %>
	<p id="notice"><%= notice %></p>
	<% end %>

	<h1>Catalogo de placas base</h1>

	<% @motherboards.each do |motherboard| %>
		<div class="entry">
			<h3><%= motherboard.title %></h3>
			<%= sanitize(motherboard.description) %>
			<div class="price_line">
				<span class="price"><%= number_to_currency(motherboard.price) %></span>
				<% prod = Product.find(:first, :conditions => ["heir_id = ? and heir_type = ?",motherboard.id, 'Motherboard']) %>
				<%= button_to 'Añadir a la configuracion', line_products_path(product_id: prod.id) %>
			</div>
		</div>
	<% end %>
<% end %>
